/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CompetenceItem.java
 *
 * Created on Jul 28, 2010, 2:06:04 PM
 */
package at.tugraz.kmi.css.cbkst2.prereq.structurevis;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JList;
import javax.swing.ListCellRenderer;

import at.tugraz.kmi.css.cbkst2.CbKSTCompetence;

/**
 * 
 * @author Georg Öttl
 */
public final class CompetenceItem extends javax.swing.JPanel implements
		ListCellRenderer {

	/**
	 * 
	 */
	private static final long	serialVersionUID	= 1L;

	/** Creates new form CompetenceItem */
	public CompetenceItem() {
		initComponents();
	}

	@Override
	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean sel, boolean focus) {
		if (sel) {
			setBackground(Color.GRAY);
		} else {
			setBackground(Color.WHITE);
		}
		CbKSTCompetence st = (CbKSTCompetence) value;
		jLabel1.setText("<html>" + st.getName() + "</html>");
		return this;
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();

		jLabel1.setText("jLabel1");

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 174,
				Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 17,
				Short.MAX_VALUE));
	}// </editor-fold>//GEN-END:initComponents
		// Variables declaration - do not modify//GEN-BEGIN:variables

	private javax.swing.JLabel	jLabel1;
	// End of variables declaration//GEN-END:variables
}
